<?php
$file = "unix_abc1";
$sockfd = socket_create(AF_UNIX,SOCK_STREAM,0);
socket_bind($sockfd,$file);
socket_listen($sockfd,5);

$connfd = socket_accept($sockfd);

if ($connfd){
    while (1){
       $data = socket_read($connfd,1024);
       if ($data){
           fprintf(STDOUT,"recv from client:%s\n",$data);
           socket_write($connfd,$data,strlen($data));
       }
       if (strncasecmp(trim($data),"quit",4)==0){
           break;
       }
    }
}
socket_close($connfd);
socket_close($sockfd);
